//正则库的简单使用
#include<iostream>
#include<string>
#include<regex>

void req_line(){
    std::string str="GET /bitejiuyeke?a=b&c=d HTTP/1.1\r\n";
    std::regex rg("(GET|HEAD|POST|PUT|DELETE) (([^?]+)(?:\\?(.*?)?)) (HTTP/1\\.[01])(?:\n|\r\n)");
    std::smatch matches;
    std::regex_match(str,matches,rg);
    int i=0;
    for(const auto& it:matches){
        std::cout<<i<<": ";
        std::cout<<matches[i++]<<std::endl;
    }
    if(matches[4].length()){
        std::cout<<"have param\n";
    }else{
        std::cout<<"have not param!\n";
    }
    return;
}

int main(){
    req_line();
    return 0;
}